﻿define(['services/dataservice', 'utils','config','common.consts'],
  function (DataService, utils, config, consts) {
  	
	    var thisObj = new DataService();
	    thisObj.getLocalData = function (param) {
	        return 'cabinet-detail.json';
	    };
	
		thisObj.getRequestUrl = function() {
			var self = this;
			var url = '';
			if (config.runMode === 'PRO') {
				url += consts.API_PATH.PRO_PRODUCT_ACTIONS;
	
				if (self.method === 'GET') {
					url += "?request={request}";
				}
			} else {
				url += consts.API_PATH.DEV;
				url += '{request}';
			}
			return url;
		}; 
	
	    thisObj.init("getcabinets");
	
		var getCabinets = function (callbacks, param) {
		    var fn;
		    fns = {
		        success: function (data) {
		        	//alert("json==="+data.cabinets['listimage']);
		        	if(data.cabinets['listimage'] != null){
		        		for(var i=0;i< data.cabinets['listimage'].length; i++ ){
							//data.cabinets['listimage'][i].pathmedium = "{gallery: 'gal1', smallimage: '" + data.cabinets['listimage'][i].pathmedium + "',largeimage: '" + data.cabinets['listimage'][i].pathlarge + "'}";
							data.cabinets['listimage'][i].pathlarge = "{gallery: 'gal1', smallimage: '" + data.cabinets['listimage'][i].pathmedium + "',largeimage: '" + data.cabinets['listimage'][i].pathlarge + "'}";
				    	}
		        	}
		            callbacks.success(data.cabinets);
		        },
		        error: callbacks.error
		    };
		    thisObj.sendRequest(fns, param);
		  };
		 
		  return {
		      getCabinets: getCabinets
		  };
}); 